import { Column, Entity, OneToOne, PrimaryColumn } from 'typeorm'
import { User } from './user.model'

@Entity()
export class UserWebhook {
  @PrimaryColumn({ unique: true })
  declare id: string // user id

  @Column({ type: 'boolean' })
  enabled = false

  @Column({ type: 'jsonb' })
  headers: Record<string, string> = {}

  @Column({ nullable: true, default: null })
  url?: string

  @OneToOne(() => User, u => u.webhook)
  declare user: User
}
